--- @diagnostic disable: duplicate-doc-field, missing-return, duplicate-doc-alias, duplicate-set-field

--- 地图信息文件
do
    --- @class Csharp.Vector2
    --- @field X number
    --- @field Y number

    --- @class Csharp.War3Map.info.CameraBounds
    --- @field BottomLeft Csharp.Vector2
    --- @field TopRight Csharp.Vector2
    --- @field TopLeft Csharp.Vector2
    --- @field BottomRight Csharp.Vector2

    --- @class Csharp.War3Map.info.Data
    --- @field MapName string 地图名字
    --- @field MapAuthor string 作者名字
    --- @field MapVersion integer 地图版本
    --- @field MapDescription string 地图描述
    --- @field LoadingScreenPath string 载入图路径
    --- @field EditorVersion integer 编辑器版本
    --- @field CameraBounds Csharp.War3Map.info.CameraBounds 镜头边界

    --- @class Csharp.War3Map.w3i
    --- @field Data Csharp.War3Map.info.Data
end

--- 地图平衡常数
do
    --- @class Csharp.War3Map.misc
    --- @field MapMiscData Misc
end

--- 地图平衡常数
do
    --- @class Csharp.War3Map.skin
    --- @field MapSkinData Skin
end

--- 物编注解
do
    --- @class Csharp.War3Map.Object
    --- @field NewId integer # 物编 ID [倒序 需要用<I4 来pack]
    --- @field OldId integer # 物编父级 ID [倒序 需要用<I4 来pack]

    --- w3u
    do
        --- @class Csharp.War3Map.w3u.Object : Csharp.War3Map.Object
        --- @field Set fun(self:self,key:Csharp.War3Map.w3u.AttributeKey,value:any) 查找物编 ID = 'O000'
        --- @field Get fun(self:self,key:Csharp.War3Map.w3u.AttributeKey):any 获取数据

        --- @class Csharp.War3Map.w3u.ListObject
        --- @field [integer] Csharp.War3Map.w3u.Object
        --- @field Remove fun(self:self,obj:Csharp.War3Map.w3u.Object) 删除物编

        --- @class Csharp.War3Map.w3u
        --- @field Find fun(self:self,ID:string):Csharp.War3Map.w3u.Object 查找物编 ID = 'O000'
        --- @field New fun(self:self,NewID:string,OldID:string):boolean,Csharp.War3Map.w3u.Object 新建物编
        --- @field BaseObjects Csharp.War3Map.w3u.ListObject
        --- @field NewObjects Csharp.War3Map.w3u.ListObject
    end

    --- w3t
    do
        --- @class Csharp.War3Map.w3t.Object : Csharp.War3Map.Object
        --- @field Set fun(self:self,key:Csharp.War3Map.w3t.AttributeKey,value:any) 查找物编 ID = 'O000'
        --- @field Get fun(self:self,key:Csharp.War3Map.w3t.AttributeKey):any 获取数据

        --- @class Csharp.War3Map.w3t.ListObject
        --- @field [integer] Csharp.War3Map.w3t.Object
        --- @field Remove fun(self:self,obj:Csharp.War3Map.w3t.Object) 删除物编

        --- @class Csharp.War3Map.w3t
        --- @field Find fun(self:self,ID:string):Csharp.War3Map.w3t.Object 查找物编 ID = 'I000'
        --- @field New fun(self:self,NewID:string,OldID:string):boolean,Csharp.War3Map.w3t.Object 新建物编
        --- @field BaseObjects Csharp.War3Map.w3t.ListObject
        --- @field NewObjects Csharp.War3Map.w3t.ListObject
    end

    --- w3a
    do
        --- @class Csharp.War3Map.w3a.Object : Csharp.War3Map.Object
        --- @field Set fun(self:self,key:Csharp.War3Map.w3a.AttributeKey,level:integer,value:any) 查找物编 ID = 'A000'
        --- @field Get fun(self:self,key:Csharp.War3Map.w3a.AttributeKey,level?:integer):any 获取数据 等级默认为1

        --- @class Csharp.War3Map.w3a.ListObject
        --- @field [integer] Csharp.War3Map.w3a.Object
        --- @field Remove fun(self:self,obj:Csharp.War3Map.w3a.Object) 删除物编

        --- @class Csharp.War3Map.w3a
        --- @field Find fun(self:self,ID:string):Csharp.War3Map.w3a.Object 查找物编 ID = 'A000'
        --- @field New fun(self:self,NewID:string,OldID:string):boolean,Csharp.War3Map.w3a.Object 新建物编
        --- @field BaseObjects Csharp.War3Map.w3a.ListObject
        --- @field NewObjects Csharp.War3Map.w3a.ListObject
    end
end
do
    ---@class War3Map.MpqFile
    ---@field FileName string MPQ内的文件名
    ---@field Save fun(self:self,filePath:string) 保存在指定路径
    ---@field SetContext fun(self:self,Context:string) 保存内容到文件
    ---@field GetContext fun(self:self):string 获取内容

    ---@class Csharp.War3Map.ListFiles
    ---@field [integer] War3Map.MpqFile
    ---@field Count integer

    --- @class Csharp.War3MapBuilder
    --- @field Map Csharp.War3Map
    --- @field ListFiles Csharp.War3Map.ListFiles
    --- @field EnableLuac boolean 开启Luac
    --- @field EnableSlk boolean 开启Slk
    --- @field EncodeKKWEJass boolean 使用KKWE加密
    local builder = {}

    --- 导入图文件
    --- @param archiveName string MPQ文件名
    --- @param FullName string 要注入的文件路径
    --- @param removeUnused? boolean 标记移除未使用文件
    function builder:AddFile(archiveName, FullName, removeUnused) end

    --- 导入文件夹
    --- @param folderPath string 文件夹
    --- @param prefix? string MPQ文件名前缀
    --- @param removeUnused? boolean 标记移除未使用文件
    function builder:AddFiles(folderPath, prefix, removeUnused) end

    --- 导入文件内容到文件
    --- @param archiveName string MPQ文件名
    --- @param context string 文件内容
    function builder:AddFileContext(archiveName, context) end

    ---判断文件是否存在
    ---@param archiveName string
    ---@return boolean
    function builder:HasFile(archiveName) end

    ---获取文件
    ---@param archiveName string
    ---@return War3Map.MpqFile?
    function builder:GetFile(archiveName) end

    --- 构造地图
    --- #### 需要 Build:Wait()一下
    --- @param OutPath string 导出路径
    --- @return Csharp.Task
    --- @nodiscard
    function builder:Build(OutPath) end

    --- @class Csharp.War3MapPluginBuilder : Csharp.War3MapBuilder
    --- @field ScriptType "运行地图前执行"|"生成发布版前执行"|"生成发布版后执行"
end

--- 云脚本进入压缩包事件
do
    --- @class Csharp.BuilderCloudLuaFile
    --- @field ArchiveName string 文件名
    --- @field Context string 文件内容
    --- @field Option Csharp.LuacFileBuilderOption 无法使用
end

--- 打包时的file事件回调
do
    --- @class Csharp.FileBuilderOption
    --- @field FileDelete boolean 默认为false

    --- @class Csharp.BuilderFile
    --- @field ArchiveName string
    --- @field Context string 可修改！
    --- @field Option Csharp.FileBuilderOption
end

--- 打包时的Lua事件回调
do
    --- @class Csharp.LuacFileBuilderOption
    --- @field IsLuac boolean 默认true
    --- @field LuaType "PluginLua"|"YDLua" --默认PluginLua
    --- @field IsOut_O boolean
    --- @field IsOut_S boolean

    --- @class Csharp.BuilderLuacFile
    --- @field ArchiveName string
    --- @field Context string 可修改！
    --- @field Option Csharp.LuacFileBuilderOption
end

--- @class Csharp.War3Map
--- @field info Csharp.War3Map.w3i
--- @field skin Csharp.War3Map.skin
--- @field misc Csharp.War3Map.misc
--- @field w3u  Csharp.War3Map.w3u
--- @field w3t  Csharp.War3Map.w3t
--- @field w3a  Csharp.War3Map.w3a
--- @field GetFile fun(self:self,archiveName:string):War3Map.MpqFile? 获取文件(需要打开MPQ)
--- @field ExtractFile fun(self:self,archiveName:string,foldPath):War3Map.MpqFile? 导出文件(如果是资源文件需要打开MPQ)
--- @field CreateBuild fun(self:self,RootPath:string) 导出.build到文件夹
--- @field CreateBuilder fun(self:self):Csharp.War3MapBuilder 创建构建器
--- @overload fun(buildPath:string):Csharp.War3Map 打开文件夹地图
--- @overload fun(w3xPath:string,useMPQ?:boolean):Csharp.War3Map 打开地图文件(是否打开MPQ)
War3Map = {}
